package cn.com.xyzq.reks.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.appfuse.model.BaseObject;

@Entity
@Table(name = "staff")
@XmlRootElement
public class Staff extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2061324442641054955L;
	private Long id;
	private Integer staffId;
	private String name;
	private String dept;
	private Integer team;
	private boolean leader;
	private boolean manager;
	private boolean status;
	private String remark;

	public Staff() {
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	@Column(name = "staff_id", unique = true, nullable = false)
	public Integer getStaffId() {
		return staffId;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return name;
	}

	@Column(name = "dept", columnDefinition = "enum('market','server','computer','integration','depository','director','manager')", nullable = false)
	public String getDept() {
		return dept;
	}

	@Column(name = "team")
	public Integer getTeam() {
		return team;
	}

	@Column(name = "leader")
	public boolean isLeader() {
		return leader;
	}

	@Column(name = "manager")
	public boolean isManager() {
		return manager;
	}

	@Column(name = "status")
	public boolean isStatus() {
		return status;
	}

	@Column(name = "remark", length = 50)
	public String getRemark() {
		return remark;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setStaffId(Integer staffId) {
		this.staffId = staffId;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDept(String dept) {
		this.dept = dept;
	}

	public void setTeam(Integer team) {
		this.team = team;
	}

	public void setLeader(boolean leader) {
		this.leader = leader;
	}

	public void setManager(boolean manager) {
		this.manager = manager;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE)
				.append("staff ID", this.staffId).append("name", this.name)
				.append("department", this.dept).append("team", this.team)
				.append("leader", this.leader).append("manager", this.manager)
				.append("status", this.status).append("remark", this.remark)
				.toString();
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		if (this == o) {
			return true;
		}
		if (!(o instanceof Staff)) {
			return false;
		}

		final Staff staff = (Staff) o;

		return !(staffId != null ? !staffId.equals(staff.getStaffId()) : staff
				.getStaffId() != null);
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return (getStaffId() != null ? getStaffId().hashCode() : 0);
	}

}
